package com.yjweb.webportal.controller;

import com.yjweb.webportal.entities.Solution;
import com.yjweb.webportal.entities.SolutionMaster;
import com.yjweb.webportal.service.SolutionMasterService;
import com.yjweb.webportal.service.SolutionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("solution")
public class SolutionContoller {
    @Autowired
    private SolutionMasterService  solutionMasterService= null;
    @Autowired
    private SolutionService solutionService=null;
    @RequestMapping("/")
    ModelAndView index(){
        ModelAndView mav = new ModelAndView("solution/index");
        List<SolutionMaster> masters = solutionMasterService.list();
        mav.addObject("model",masters);
        return mav;
    }
    @RequestMapping("/{msysno}")
    ModelAndView details(@PathVariable("msysno") Integer msysno){
        ModelAndView mav = new ModelAndView("solution/detail");
        List<Solution> solutions = solutionService.list(msysno);
        mav.addObject("model",solutions);
        return mav;
    }
}
